<template>
	<view class="doc" :class="{popupShow:popupShow}">
		<!-- 医生详情 -->
		<u-navbar title="医生主页" :autoBack="true">
		</u-navbar>
		<view class="docinfo">
			<view class="info">
				<view class="infol">
					<view class="docimg" v-if="docinfo.avatar">
						<!-- <image :src="docinfo.avatar" mode="aspectFit"></image> -->
						<u-avatar :src="docinfo.avatar" size="45" shape="circle" :default-url="log_pic"></u-avatar>
					</view>
					<view class="docimg" v-if="!docinfo.avatar">
						<image src="../../static/icons/yimo.png" mode="aspectFit"></image>
					</view>
					<view class="doctit">
						<view class="docname">
							{{docinfo.doctor_name?docinfo.doctor_name:""}}
							<span>{{docinfo.doctor_title?docinfo.doctor_title:""}}</span>
						</view>


					</view>
				</view>
				<view class="infor">

					<view class="inforitemr" @click="guanzhu()" v-if="docinfo.state==false">
						+ 关注
					</view>
					<view class="inforitemr" @click="cancelguanzhu()"
						style="border: none;background-color: #f7f7f7;color: #888;" v-if="docinfo.state==true">
						已关注
					</view>
				<!-- 	<view class="inforiteml" @click="fenxiang()">
						<view class="inforitemll">
							<u-icon name="share-square" size="18" color="#417ef7"></u-icon>
						</view>
					</view> -->
				</view>
			</view>
			<view class="dochos">
				<view class="zhilogo">
					<image src="../../static/icons/zhiye.png" mode="aspectFit"></image>
				</view>
				<view class="hosnamea">
					{{docinfo.office_location_hospital?docinfo.office_location_hospital:""}}
					<view class="hostype">
						{{docinfo.hospital_level?docinfo.hospital_level:""}}
					</view>
				</view>

			</view>
			<view class="doctaglist">
				<view class="doctag" v-for="it in docinfo.platlabel" :style="{background:it.bgcolor,color:it.color}">
					{{it}}
				</view>


			</view>
			<view class="pingfen" v-if="pingfen.score">
				<p style="color: #EB7637;font-weight: bold;font-size: 26rpx;">{{pingfen.score}}分</p>
				<!-- <p>评分</p> -->
			</view>
			<!-- 	<view class="docnum">
				<view class="docnumitem">
					评价 <span>9.分</span>
				</view>
				<view class="docnumitem" style="text-align: center;">
					预约 <span>888</span>
				</view>
				<view class="docnumitem" style="text-align: right;">
					关注 <span>888</span>
				</view>
			</view> -->
			<view class="goodat">
				<view class="ginfo">
					擅长：{{goodat?goodat:"暂无"}}
				</view>




				<view class="lijie" @click="goliaojie()">
					了解医生>
				</view>
			</view>
		</view>
		<!-- 号源 -->
		<view class="hoslist" v-for="item in hoslist">
			<view class="hosmain">
				<view class="hositem">
					<view class="hostop">
						<view class="hostopl">
							<view class="hosnum" :style="{background:item.color}">
								{{item.num}}
							</view>
							<view class="hositenname" @click="gohos(item)">
								<span style="color: #333;"
									v-if="item.plat_hospital_name.length<=15">{{item.plat_hospital_name}}</span>
								<span style="color: #333;"
									v-if="item.plat_hospital_name.length>15">{{item.plat_hospital_name.substr(0,15)}}..</span>
								<span>主页></span>
							</view>

						</view>
						<view class="hostopr" @click="zhankai(item)">
							<!-- 	<view class="you">
								有号
							</view> -->
							<view class="" v-if="item.show==false">
								<u-icon name="arrow-down" color="#575B66"></u-icon>
							</view>
							<view class="" v-if="item.show==true">
								<u-icon name="arrow-up" color="#575B66"></u-icon>
							</view>
						</view>
					</view>
					<view class="" v-if="hosid==item.hospitalId">
						<view class="hosdep">
							<view class="depitem" v-for="itdep in item.deptplace"
								:class="{ activedep: activedep == itdep.departmentBasicId}" @click="choosedep(itdep)">
								{{itdep.dept_name}}
								<view class="dian" v-if="activedep == itdep.departmentBasicId">
									.
								</view>
							</view>

						</view>
						<view class="suoyou">
							<view class="allhao" @click="getsuoyou()">

								<view class="suoi" :class="{ activeall: activeall == 1}">
									<u-icon name="checkbox-mark" color="#fff" size="16"></u-icon>
								</view>
								<view class="suotit">
									所有号源
								</view>
							</view>
							<view class="shuaxin" @click="getpaiban()">
								<image src="../../static/icons/shuaxin.png" mode="aspectFit"></image>刷新
							</view>
						</view>
						<view class="haoyuan">
							<view class="haoyuanl">
								<view class="">
									上午
								</view>
								<view class="">
									下午
								</view>
							</view>
							<view class="haoyuanr">
								<ul>
									<li v-for="itam in haowulist">
										<view class="datetop">
											<p>{{itam.week}}</p>
											<p>{{itam.date.slice(5)}}</p>
										</view>
										<!-- 上午 -->
										<view class="" v-if="itam.schedules!=null">
											<view class="" v-if="itam.schedules.am!=null">
												<view class="haoitem" v-if="itam.schedules.am.state=='4'">

												</view>
												<view class="haoitem" style="background-color: #4581f7;"
													@click="gethao(itam.schedules.am,item)"
													v-if="itam.schedules.am.state=='1'">
													预约
												</view>
												<view class="haoitem"
													style="background-color: #e2eff8;color: #e54032;font-weight: bold;"
													@click="yuman()" v-if="itam.schedules.am.state=='2'">
													约满
												</view>
												<view class="haoitem"
													style="background-color: #e2eff8;color: #fcc525;font-weight: bold;"
													@click="tingzhen()" v-if="itam.schedules.am.state=='3'">
													停诊
												</view>
												<view class="haoitem"
													style="background-color: #e2eff8;color: #999;font-weight: bold;"
													@click="tingzhen()" v-if="itam.schedules.am.state=='5'">
													停约
												</view>
											</view>
											<view class="" v-if="itam.schedules.am==null">
												<view class="haoitem">

												</view>

											</view>
											<!-- 下午 -->
											<view class="" v-if="itam.schedules.pm!=null">
												<view class="haoitem" v-if="itam.schedules.pm.state=='4'">

												</view>
												<view class="haoitem" style="background-color: #4581f7;"
													@click="gethao(itam.schedules.pm,item)"
													v-if="itam.schedules.pm.state=='1'">
													预约
												</view>
												<view class="haoitem"
													style="background-color: #e2eff8;color: #e54032;font-weight: bold;"
													@click="yuman()" v-if="itam.schedules.pm.state=='2'">
													约满
												</view>
												<view class="haoitem"
													style="background-color: #e2eff8;color: #fcc525;font-weight: bold;"
													@click="tingzhen()" v-if="itam.schedules.pm.state=='3'">
													停诊
												</view>
												<view class="haoitem"
													style="background-color: #e2eff8;color: #999;font-weight: bold;"
													@click="tingzhen()" v-if="itam.schedules.pm.state=='5'">
													停约
												</view>
											</view>
											<view class="" v-if="itam.schedules.pm==null">
												<view class="haoitem">

												</view>

											</view>
										</view>
										<!-- 结束 -->
										<view class="" v-if="itam.schedules==null">

											<view class="haoitem">

											</view>



											<view class="haoitem">

											</view>



										</view>
									</li>

								</ul>
							</view>
						</view>
						<view class="haoshuo">
							<view class="haoshuol">
								<view class="haoloitem">
									<view class="haologo">

									</view>
									<view class="haologoinfo">
										预约
									</view>
								</view>
								<view class="haoloitem">
									<view class="haologo" style="background-color: #e54032;">

									</view>
									<view class="haologoinfo">
										约满
									</view>
								</view>
								<view class="haoloitem">
									<view class="haologo" style="background-color: #fcc525;">

									</view>
									<view class="haologoinfo">
										停诊
									</view>
								</view>
								<view class="haoloitem">
									<view class="haologo" style="background-color: #999;">

									</view>
									<view class="haologoinfo">
										停约
									</view>
								</view>

							</view>
							<view class="haoshuor" @click="showshuo()">
								号源说明>
							</view>
						</view>
						<view class="zhu">
							注：{{item.release_no_time}}放出最新一天的排班。是否有号以医院实际安排为准。
						</view>
					</view>

				</view>

			</view>
		</view>
		<!-- 评价 -->
		<view class="comment">
			<view class="commore" v-if="pinglist.length>0">
				<view class="commoremain">
					<view class="commorel">
						患者评价 <span v-if="pingtotal">({{pingtotal}})</span>
					</view>
					<view class="commorer" @click="goallping()">
						查看全部>
					</view>
				</view>
			</view>
			<view class="commenlist" v-if="pinglist.length>0">
				<view class="commenitem" v-for="item in pinglist">
					<view class="zhiding" v-if="item.top=='1'">
						<image src="../../static/icons/zhiding.png" mode="aspectFit"></image>
					</view>
					<view class="remen" v-if="item.delicacy=='1'">
						<image src="../../static/icons/remen.png" mode="aspectFit"></image>
					</view>
					<view class="comhos">
						<view class="comhosmain">
							<view class="zhi" style="display: flex;">
								<u-icon name="map-fill"></u-icon><span style="margin-left: 10rpx;">执业地点</span>
							</view>
							<view class="zhiinfo">
								{{item.departmentsName}} {{item.hospitalName}}
							</view>
						</view>
					</view>
					<view class="comall">
						<view class="comtop">
							<view class="comtopl">
								{{item.userName}}
								<span>{{item.diagnosis}}</span>
							</view>
							<view class="comtopr">
								<u-rate :count="count" v-model="item.totalScore" active-color="#F2CB51"></u-rate>
							</view>
						</view>
						<view class="cominfo" v-if="item.showText">
							{{item.commentContent}}

						</view>
						<view class="cominfo" v-if="!item.showText">
							{{item.commentContent.substr(0, 53)}}...

						</view>
						<view class="" v-if="item.showText">
							<text v-if="item.commentContent !== null && item.commentContent.length > 53"
								class="full_text" @click="toggleDescription(item)">收起</text>
						</view>
						<view class="" v-if="!item.showText">
							<text v-if="item.commentContent !== null && item.commentContent.length > 53"
								class="full_text" @click="toggleDescription(item)">查看全部></text>
						</view>
						<view class="combot">
							<view class="cbotl">
								<view class="cbotli">
									<image mode="aspectFit" src="../../static/icons/chakan.png"></image>
									<span style="margin-left: 10rpx;">{{item.viewCount}}</span>
								</view>
								<view class="cbotli" @click="dian(item)">
									<image v-if="item.dianshow==false" mode="aspectFit" src="../../static/icons/dz.png">
									</image>
									<image v-if="item.dianshow==true" mode="aspectFit" src="../../static/icons/dza.png">
									</image>
									<span>{{item.praiseClick}}</span>
								</view>
							</view>
							<view class="cbotr">
								{{item.createTime}}
							</view>
						</view>
					</view>
				</view>

			</view>

			<view class="" v-else style="text-align: center;height: 800rpx;">
				<image style="width: 300rpx;height: 200rpx;margin: 0 auto;margin-top: 30rpx;"
					src="../../static/icons/wuping.png" mode="aspectFit"></image>
				<p style="font-size: 24rpx; color: #737B80;margin-top: 10rpx;">暂无评价内容</p>
			</view>
		</view>

		<u-popup :show="showhaoyuan" @close="closehaoyuan()" mode="bottom" :round="10" :closeable="true">
			<scroll-view :scroll-into-view="toView" scroll-y="true" style="height: 800rpx;"
				scroll-with-animation="true">
				<view class="pophaoyuan">
					<view class="haoinfo">
						<view class="haotit">
							{{xiaoshilist[0].serviceDate?xiaoshilist[0].serviceDate:""}}
							{{xiaoshilist[0].week?xiaoshilist[0].week:""}}
							{{xiaoshilist[0].noonName?xiaoshilist[0].noonName:""}} 诊疗费
							<span>{{xiaoshilist[0].fee}}</span>
						</view>
						<view class="haoi">
							{{hosname?hosname:""}} {{xiaoshilist[0].deptName?xiaoshilist[0].deptName:""}}
						</view>
					</view>
					<view class="haolist">
						<view class="haoitemm" @click="choosehao(item)" :class="{ active: active == item.ext}"
							v-for="item in xiaoshilist">
							<p>{{item.startTime?item.startTime:""}}-{{item.endTime?item.endTime:""}}</p>
							<p>余<span>{{item.leftNum?item.leftNum:""}}</span></p>
						</view>

					</view>
					<view class="confirm" @click="confirmorder()">
						确定
					</view>
				</view>
			</scroll-view>
		</u-popup>
		<u-popup :show="showshuoming" @close="closehaoshuo()" mode="bottom" :round="10" :closeable="true">
			<view class="shuoming">
				<view class="shuomingmain">
					<view class="shuoitem">
						<view class="shuoiteml">
							预约
						</view>
						<view class="shuoitemr">
							<p class="shuot"> 可预约号源</p>
							<p class="shuoi">你可点击后选择时间段进行预约</p>
						</view>
					</view>
					<view class="shuoitem">
						<view class="shuoiteml" style="background-color: #e54032;">
							约满
						</view>
						<view class="shuoitemr">
							<p class="shuot"> 医生号源已约满</p>
							<p class="shuoi">医生在此时间段的号源已约满</p>
						</view>
					</view>
					<view class="shuoitem">
						<view class="shuoiteml" style="background-color: #fcc525;">
							停诊
						</view>
						<view class="shuoitemr">
							<p class="shuot"> 医生已停诊</p>
							<p class="shuoi">医生在此时间段停诊</p>
						</view>
					</view>
					<view class="shuoitem">
						<view class="shuoiteml" style="background-color: #999;">
							停约
						</view>
						<view class="shuoitemr">
							<p class="shuot"> 医生已停约</p>
							<p class="shuoi">医生在此时间段停约</p>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-modal :show="show" title="温馨提示" @close="close()" :closeOnClickOverlay="true" :content='content'
			@cancel="cancel()" :showCancelButton="true" @confirm="contihuan()"></u-modal>
		<u-modal :show="gongshow" title="温馨提示" @close="closegong()" :closeOnClickOverlay="true" :content='gongcontent'
			@confirm="closegong()"></u-modal>
		<!-- <u-popup :show="showw" :round="10" mode="center" width="80%" :closeable="true" @close="closee" height="100vh"
			border-radius="10">
			<view class="pop">
				
				<view class="cardimg">
					<image src="../../static/icons/cardicon.png" mode=""></image>
				</view>
				<view class="hosname">
					河南预约挂号平台
				</view>
				<view class="" v-if="showpp">
					<health-card-login encrypt="true" authLogin="false" @authFail="authFail" @authSucess="authSuccess"
						:authCancel="authCancel" wechatcode="true">
						<view class="foott">
							<view @click="hideComponentLogin()" class="agree">一键登录授权</view>
						</view>
						<view class="shuoming">
							登录代表同意<span @click="goxieyi()">《用户服务协议与隐私政策》</span>并授权使用您的账号信息以便您统一管理
						</view>
					</health-card-login>
				</view>
			</view>
		</u-popup> -->
		<u-popup customStyle="width:700rpx;" class="tanchuang" :show="showw" :round="10" mode="center" width="80%" :closeable="true" @close="closee" height="" border-radius="10">
			<view class="pop">
		
				<view class="cardimg">
					<image src="../../static/icons/cardicon.png" mode=""></image>
				</view>
				<view class="hosname">
					河南预约挂号平台
				</view>
				<view class="" v-if="showpp">
					<health-card-login encrypt="true" authLogin="false" @authFail="authFail" @authSucess="authSuccess" :authCancel="authCancel"
					 wechatcode="true">
						<view class="foott">
							<view @click="hideComponentLogin()" class="agree">一键登录授权</view>
						</view>
						<view class="shuomingg">
							登录代表同意<span @click="goxieyi()">《用户服务协议与隐私政策》</span>并授权使用您的账号信息以便您统一管理
						</view>
					</health-card-login>
				</view>
			</view>
		</u-popup>
		<u-modal :showCancelButton="true" @cancel="canceljian()" @confirm="quedingjian()" :show="showjian"
			:title="titlejian" :content='contentjian'></u-modal>
	</view>
</template>

<script>
	import parse from 'mini-html-parser2'
	import homeApiii from '@/api/homeee'
	import homeApii from '@/api/homee'
	import homeApi from '@/api/home'
	import {
		reportCmPV
	} from '../../api/cloudMonitorHelper.js';
	export default {
		data() {
			return {
				titlejian: "温馨提示",
				contentjian: "您还未建主档案，请先完善信息。",
				log_pic: require('@/static/icons/yimo.png'),
				show: false,
				content: "",
				showshuoming: false,
				popupShow: false,
				guanshow: false,
				count: 5,
				activedep: "",
				activeall: "",
				active: "",
				goodat: '',
				showhaoyuan: false,
				showdocinfo: false,
				hosid: "",
				hoslist: [],
				pinglist: [],
				haowulist: [],
				haolist: [

				],
				haoo: "",
				hao: "",
				token: '',
				docinfo: "",
				xiaoshilist: "",
				docid: "",
				hosname: "",
				haoinfo: "",
				paibanid: "",
				pageNumber: "0",
				pageSize: "5",
				pingtotal: "",
				userinfo: "",
				gongshow: false,
				doctor_code: "",
				gongcontent: "",
				pingfen: "",
				huanphone: "",
				wechatCode: '',
				showw: false,
				showpp: false,
				showjian: false  
			}
		},
		// 页面分享事件处理函数
		onShareAppMessage() {
			return {
				title: this.docinfo.doctor_name, // 标题
				desc: this.docinfo.detail, // 描述
				path: `pages/docinfo/docinfo?doctorId=${this.docid}`, // 分享的小程序页面
				success(res) {
					console.log('success', res);
				},
				fail(res) {
					console.log('fail', res)
				}
			}
		},
		async onLoad(option) {
		uni.showShareMenu({
			withShareTicket: true,
			menus: ["shareAppMessage", "shareTimeline"]
		})
			this.docid = option.doctorId
			// this.docid="1686647334391517184"
			// this.activedep="1687639051286614016"
			// this.hosid="1679325309314535424"
			if (this.docid) {
				let token = uni.getStorageSync("token")
				if (token) {
					this.token = token
					// this.getuserinfo()
				} else {
					await this.gettoken()
				}
				this.getdocinfo()
				// this.getguanzhu()
			} else {
				uni.showToast({
					title: "无医生参数",
					icon:"none"
				})
			}


		},
		
		methods: {
			getguanzhu() {
				homeApi.getdocfen({
					doctorId: this.docid,
					doctorCode: this.docinfo.doctor_code
				}).then(res => {
					this.pingfen = res.data
				})
			},
			gohos(item) {
				uni.navigateTo({
					url: `/pages/sousuo/search_hosp_details/index?id=${item.hospitalId}`
				})
			},
			tingzhen() {
				uni.showToast({
					title: "该时间段已停诊",
					icon:'none'
				})
			},
			yuman() {
				uni.showToast({
					title: "该时间段已约满",
					icon:'none'
				})
			},
			getpingjia() {
				homeApi.getpingjia({
					doctorId: this.docid,
					doctorCode: this.docinfo.doctor_code,
					pageNumber: this.pageNumber,
					pageSize: this.pageSize
				}).then(res => {
					if (res.data) {
						this.pingtotal = res.data.total
						this.pinglist = res.data.comments
						this.pinglist.forEach(al => {
							al.dianshow = false
							if (al.commentContent.length > 60) {
								al.showText = false
							} else {   
								al.showText = true
							}
						})
					}

				})
			},
			canceljian() {
				this.showjian = false
			},
			getdocfollowstate() {
				homeApi.getdocfollow({
					token: this.token,
					contentId: this.docid
				}).then(res => {
					this.docinfo.state = res.data.flag
					this.$forceUpdate();
					console.log(this.docinfo)
				})
			},
			getsuoyou() {
				this.activeall = "1"
				this.activedep = ""
				this.getpaiban()

			},
			gethoslist() {
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				let colorlist = ["#F3B242", "#78CF88", "#53bff5"]
				homeApi.gethoslist({
					doctorId: this.docid
				}).then(res => {
					uni.hideLoading()
					this.hoslist = res.data
					// this.hosid=res.data[0].hospitalId
					// this.hosname=res.data[0].plat_hospital_name
					this.hosid = this.docinfo.hospitalId
					this.hoslist.forEach(el => {
						if (el.hospitalId == this.hosid) {
							this.hosname = el.plat_hospital_name
							console.log(this.hosname)
						}
					})
					// this.hosname=this.docinfo.office_location_hospital
					if (this.activedep == "") {
						this.activeall = "1"
					}
					this.getpaiban()
					console.log(this.hosid, "123456")
					for (let i = 0; i < colorlist.length; i++) {
						for (let j = 0; j < this.hoslist.length; j++) {
							this.hoslist[j].num = j + 1
							this.hoslist[j].show = false
							if (j == i) {
								this.hoslist[j].color = colorlist[i]
							}
						}
					}
				})
			},
			getpaiban() {
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				console.log(this.activedep, "111")
				homeApi.getpaiban({
					hospitalId: this.hosid,
					departmentBasicId: this.activedep,
					doctorId: this.docid
				}).then(res => {
					uni.hideLoading()
					this.haowulist = res.data
				})
			},
			getdocinfo() {
				uni.showLoading({
					title: '加载中',
					mask: true
				});

				let colorlistt = [{
						bgccolor: "#FAD9A7",
						color: "#91562E"
					},
					{
						bgccolor: "#FFCFB5",
						color: "#D06B00"
					}

				]
				homeApi.getdocinfo({
					doctorId: this.docid
				}).then(res => {
					uni.hideLoading()
					console.log(res)
					if (res.code == 4000) {
						this.docinfo = res.data
						this.goodat = this.docinfo.good_at
						for (let i = 0; i < colorlistt.length; i++) {
							for (let j = 0; j < this.docinfo.platlabel.length; j++) {
								if (j == i) {
									// this.docinfo.platlabel[j].color = colorlistt[i].color
									// this.docinfo.platlabel[j].bgccolor = colorlistt[i].bgccolor
								}
							}
						}
						this.getguanzhu()
						this.getdocfollowstate()
						this.gethoslist()
						console.log(this.docinfo)
						this.getpingjia()
					} else {
						if (res.code == 4001) {
							uni.reLaunch({
								url: '/pages/sousuo/no_found/no_found'
							})
							return
						}
						uni.showToast({
							title: res.msg,
							icon:"none"
						})
					}
				})
			},
			showshuo() {
				this.popupShow = true
				this.showshuoming = true
			},
			close() {
				this.show = false
			},
			closegong() {
				this.gongshow = false
			},
			cancel() {
				this.show = false
			},
			getuserinfo() {
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				homeApii.getuserinfo({
					token: this.token
				}).then(res => {
					uni.hideLoading()
					console.log(res)
					if (res.code == 4000) {
						this.userinfo = res.data.userinfo
					}

				})
			},
			gettoken() {
				return new Promise((resolve, reject) => {
					// my.getAuthCode({
					// 	scopes: 'auth_base',
					// 	success: res => {
					// 		const authCode = res.authCode;
					// 		uni.showLoading({
					// 			title: '加载中',
					// 			mask: true
					// 		});
					// 		homeApii.getopenid({
					// 			code: authCode
					// 		}).then(res => {
					// 			uni.hideLoading()
					// 			console.log(res)
					// 			uni.setStorageSync("token", res.data.token)
					// 			this.token = res.data.token
					// 			resolve()
					// 		})
					// 	},
					// 	fail: err => {
					// 		console.log('my.getAuthCode 调用失败', err)
					// 		uni.showToast({
					// 			title: "取消授权，您将无法享用完整服务。"
					// 		})
					// 	}
					// });
				})
			},
			closee(){
				this.showw=false
			},
			guanzhu() {
				this.docinfo.state = true
				this.$forceUpdate();
				homeApi.addfollow({
					token: this.token,
					contentId: this.docid,
					content: this.docinfo.doctor_name,
					contentType: "3"
				}).then(res => {
					if (res.code == 4000) {
						uni.showToast({
							title: "已关注",
							icon:'none'
						})
					}
				})

			},

			cancelguanzhu() {
				this.docinfo.state = false
				this.$forceUpdate();
				homeApi.delfollow({
					token: this.token,
					id: this.docid,
					content: this.docinfo.doctor_name,
					contentType: "3"
				}).then(res => {
					if (res.code == 4000) {
						uni.showToast({
							title: "已取消关注",
							icon:"none"
						})
					}
				})
			},

			fenxiang() {
				// my.showSharePanel();
			
			},
			goliaojie() {
				uni.setStorageSync("doc", this.docinfo)
				uni.navigateTo({
					url: "/pages/docdescp/docdescp"
				})
			},
			choosedep(item) {
				this.activedep = item.departmentBasicId
				this.activeall = "2"
				this.getpaiban()
			},
			quedingjian() {
				if (this.wechatCode) {
              this.showjian=false
					uni.navigateTo({

						url: `/pages/mine/addcard/addcard?wechatCode=${this.wechatCode}&type=1`
					})
					console.log(this.wechatCode, '1111')
				} else {
					this.showjian=false
					this.login()
				}
			},
			confirmorder() {
				if (this.active) {
					uni.showLoading({
						title: '加载中',
						mask: true
					});
					homeApii.getuserinfo({
						token: this.token
					}).then(res => {
						uni.hideLoading()
						console.log(res)
						if (res.code == 4000) {
							this.showhaoyuan = false
							this.popupShow = false
							let xiaxinfo = {
								week: this.haoinfo.week,
								hosid: this.hosid,
								wubie: this.haoinfo.noonName,
								docname: this.docinfo.doctor_name,
								docimg: this.docinfo.avatar,
								doctitle: this.docinfo.doctor_title,
								hosname: this.hosname,
								depart: this.haoinfo.deptName,
								hospitalId: this.hosid,
								userId: "",
								guardianId: "",
								ghDoctorId: this.docid,
								ghDeptId: this.haoinfo.basicDepartmentId,
								scheduleId: this.paibanid,
								scheduleCode: "",
								serviceDate: this.haoinfo.serviceDate,
								sourceTimeld: "",
								sourceTimeType: "0",
								sourceTimeDesc: "",
								sourceStime: this.haoinfo.startTime,
								sourceEtime: this.haoinfo.endTime,
								totalFee: this.haoinfo.fee,
								checkupFee: this.haoinfo.fee,
								regFee: this.haoinfo.fee,
								otherFeeName: "无其他费用",
								otherFee: "0",
								sourceTimeExtinfo: this.haoinfo.ext,
								ext: this.haoinfo.ext
							}
							console.log(xiaxinfo)
							uni.setStorageSync("haoinfo", JSON.stringify(xiaxinfo))
							uni.navigateTo({
								url: "/pages/confirmorder/confirmorder"
							})
						} else if (res.code == 4007) {
							this.showhaoyuan = false
							this.showjian = true
							// if (this.wechatCode) {

							// 	uni.navigateTo({

							// 		url: `/pages/mine/addcard/addcard?wechatCode=${this.wechatCode}`
							// 	})
							// console.log(this.wechatCode,'1111')
							// } else {
							// 	this.login()
							// }
						}

					})



				} else {
					uni.showToast({
						title: "请选择就诊时间段",
						icon: "none"
					})
				}

			},
			hideComponentLogin() {
				this.showw = false
				uni.showLoading()
			},
			login() {
				const plugin = requirePlugin('myPlugin')
				// plugin.login(callback, options)
				plugin.login((isok, res) => {
					console.log('plugin.login: ', isok, res)
					if (res.result.type !== 3) {
						// 用户在微信授权过，可直接获取登录信息，处理后续业务
						this.todo(res)
					} else {
						// 用户未授权，需要用户同意授权
						// 显示 healthCardLogin 登录组件，引导用户同意授权
						this.showw = true
						this.showpp = true
					}
				}, {
					wechatcode: true
				})
			},
			authSuccess(data) {
				uni.hideLoading()
				let res = data.detail   
				// if(this.shengtype=="1"){
					this.todo(res)
				// }
				// if(this.shengtype=="2"){
				// 	this.todoo(res)
				// }
				// 同 plugin.login，用户同意授权，获取登录信息，处理后续业务
			},
			

			// 用户取消授权，授权失败回调
		authCancel() {
			uni.hideLoading()   
		
		},
			todo(res) {
				// 传入参数 wechatcode = true 结果输出 wechatCode ，注意大小写
				// 传入参数 healthcode = true 及健康卡卡号 ecard_no，输出healthCode
				this.wechatCode = res.result.wechatCode

				if (this.wechatCode) {
					uni.navigateTo({
						url: `/pages/mine/addcard/addcard?wechatCode=${this.wechatCode}&type=1`
					})
				} else {
					this.login()
				}

			},

			contihuan() {
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				homeApii.newphone({
					userinfoid: this.userinfo.userid,
					token: this.token,
					phone: this.huanphone
				}).then(res => {
					uni.hideLoading()
					this.show = false
					if (res.code == 4000) {
						uni.showToast({
							title: "成功",
							icon:"none"
							
						})
					}
				})
			},
			goxieyi(){
				uni.navigateTo({
					url:"/pages/xieyi/xieyi"
				})
			},
			choosehao(item) {
				this.active = item.ext
				this.haoinfo = item
			},
			gethao(item, itam) {
				console.log(itam, "123")
				if (itam.status == 2) {
					this.gongshow = true
					this.gongcontent = itam.extra_notice
				} else {
					uni.showLoading({
						title: '加载中',
						mask: true
					});

					homeApi.getxiaoshi({
						sourceId: item.sourceId
					}).then(res => {
						uni.hideLoading()
						this.xiaoshilist = res.data
					})
					this.paibanid = item.sourceId
					this.showhaoyuan = true
					this.popupShow = true
				}

			},
			goallping() {
				uni.navigateTo({
					url: "/pages/allpingjia/allpingjia?docid=" + this.docid + "&doccode=" + this.docinfo
						.doctor_code
				})
			},

			// 评价全文展开收起
			toggleDescription(num) {
				num.showText = !num.showText
				this.$forceUpdate();
			},
			dian(item) {
				item.dianshow = !item.dianshow
				if (item.dianshow == true) {
					item.praiseClick++
				}
				if (item.dianshow == false) {
					item.praiseClick--
				}
				this.$forceUpdate()
			},

			closehaoyuan() {
				this.showhaoyuan = false
				this.popupShow = false
				this.active = ""
			},
			closehaoshuo() {
				this.showshuoming = false
				this.popupShow = false
			},
			closegood() {
				this.showdocinfo = false
			},
			opengood() {
				this.showdocinfo = true
			},
			zhankai(item) {

				if (this.hosid) {
					if (this.hosid == item.hospitalId) {
						this.hosid = ""
						item.show = false
					} else {
						this.hoslist.forEach(el => {
							el.show = false
						})
						item.show = true
						this.hosid = item.hospitalId
						this.hosname = item.plat_hospital_name
						this.getpaiban()
					}

				} else {
					item.show = true
					this.hosid = item.hospitalId
					this.hosname = item.plat_hospital_name
					this.getpaiban()
				}

			}
		}
	}
</script>
<style>
	.u-modal__content{
		text-align: center;
	}
	.tanchuang{
		width: 700rpx;
		
	}
</style>
<style scoped lang="scss">
	.popupShow {
		overflow: hidden;
		position: fixed;
	}

	.pop {
			width: 90%;
			margin: 0 auto;
			overflow: hidden;
			margin-top: 150rpx;
			padding-bottom: 30rpx;
		
			.poptop {
				width: 100%;
			}
		
			.cardimg {
				width: 150rpx;
				height: 150rpx;
				margin: 0 auto;
				margin-top: 10rpx;
		
				image {
					width: 100%;
					height: 100%;
				}
			}
		
			.hosname {
				width: 95%;
				margin: 0 auto;
				text-align: center;
				font-size: 50rpx;
				font-weight: bold;
				margin-top: 80rpx;
			}
		
		
		
			.title {
				width: 100%;
				text-align: center;
				margin-top: 18rpx;
				font-size: 32rpx;
				color: #333;
				font-weight: 550;
			}
		
			.info {
				width: 80%;
				margin: 0 auto;
				margin-top: 10rpx;
				font-size: 28rpx;
			}
		
			.shuomingg {
				width: 95%;
				margin: 0 auto;
				font-size: 28rpx;
				color: #999;
				line-height: 40rpx;
				margin-top: 80rpx;
		
				span {
					color: orange;
				}
		
			}
		
			.foott {
				width: 80%;
				margin: 0 auto;
				display: flex;
				// margin-top: 20rpx;
				justify-content: space-between;
		
		
		
				.agree {
					width: 80%;
					height: 90rpx;
					margin: 0 auto;
					font-size: 34rpx;
					color: #fff;
					border-radius: 90rpx;
					line-height: 90rpx;
					text-align: center;
					background-color: #3669F8;
					margin-top: 100rpx;
				}
			}
		}
	
	.doc {
		width: 100%;
		background-color: #F5F6F8;
		padding-bottom: 100rpx;
		overflow: hidden;
		padding-top: 180rpx;

		.commore {
			width: 93%;
			margin: 0 auto;
			margin-top: 20rpx;
			border-radius: 15rpx;
			background-color: #fff;
			line-height: 80rpx;

			.commoremain {
				width: 95%;
				margin: 0 auto;
				display: flex;
				justify-content: space-between;

				.commorel {
					font-size: 30rpx;
					color: #3D3D3D;

					span {
						font-size: 24rpx;
						color: #999999;
					}
				}

				.commorer {
					font-size: 24rpx;
					color: #3D3D3D;
				}
			}
		}

		.commenlist {
			width: 93%;
			margin: 0 auto;
			margin-top: 20rpx;
			overflow: hidden;

			.commenitem {
				width: 100%;
				border-radius: 15rpx;
				background-color: #fff;
				margin-top: 20rpx;
				position: relative;

				.zhiding {
					position: absolute;
					top: 0rpx;
					right: 80rpx;

					image {
						width: 50rpx;
						height: 70rpx;
					}
				}

				.remen {
					position: absolute;
					top: 0rpx;
					right: 20rpx;

					image {
						width: 50rpx;
						height: 70rpx;
					}
				}

				.comall {
					width: 95%;
					margin: 0 auto;
					padding-top: 20rpx;
					padding-bottom: 20rpx;

					.comtop {
						display: flex;
						justify-content: space-between;

						.comtopl {
							font-size: 26rpx;
							color: #999;

							span {
								height: 35rpx;
								font-size: 20rpx;
								display: inline-block;
								padding-left: 10rpx;
								padding-right: 10rpx;
								line-height: 35rpx;
								margin-left: 10rpx;
								background-color: #eaf3fc;
								border-radius: 5rpx;
								color: #417ef7;
							}
						}

						.comtopr {
							color: #ea661f;
							font-size: 28rpx;
						}
					}

					.cominfo {
						font-size: 24rpx;
						line-height: 35rpx;
						color: #333;
						margin-top: 10rpx;
						// height: 70rpx;
						// letter-spacing: 1rpx;
						// display: -webkit-box;
						// overflow: hidden;
						// text-overflow: ellipsis;
						// word-wrap: break-word;
						// white-space: normal !important;
						// -webkit-line-clamp: 2;
						// -webkit-box-orient: vertical;
					}

					.full_text {
						font-size: 24rpx;
						color: #417ef7;
						line-height: 50rpx;
					}

					.combot {
						display: flex;
						justify-content: space-between;
						margin-top: 10rpx;

						.cbotr {
							font-size: 20rpx;
							color: #888;
						}

						.cbotl {
							display: flex;

							.cbotli {
								display: flex;
								font-size: 20rpx;
								color: #888;
								margin-right: 20rpx;

								image {
									width: 30rpx;
									height: 20rpx;
								}

								span {
									line-height: 20rpx;
								}
							}
						}
					}
				}

				.comhos {
					width: 100%;
					background-color: #efefef;
					border-radius: 15rpx 15rpx 0 0;

					.comhosmain {
						width: 95%;
						margin: 0 auto;
						padding-top: 20rpx;
						padding-bottom: 20rpx;

						.zhi {
							font-size: 28rpx;
						}

						.zhiinfo {
							font-size: 22rpx;
							color: #666;
							line-height: 40rpx;
						}
					}
				}
			}
		}

		.shuoming {
			overflow: hidden;
			width: 90%;
			margin: 0 auto;
			margin-top: 20rpx;
			padding-bottom: 100rpx;
			height: 500rpx;
			position: relative;

			.shuomingmain {
				margin-top: 40rpx;

				.shuoitem {
					width: 100%;
					display: flex;
					margin-bottom: 30rpx;

					.shuoiteml {
						width: 100rpx;
						height: 80rpx;
						background-color: #417ef7;
						color: #fff;
						font-size: 28rpx;
						line-height: 80rpx;
						border-radius: 10rpx;
						text-align: center;
					}

					.shuoitemr {
						margin-left: 20rpx;

						.shuot {
							font-size: 29rpx;
							font-weight: bold;
							line-height: 40rpx;
							color: #000000;
						}

						.shuoi {
							font-size: 26rpx;
							line-height: 40rpx;
							color: #3D3D3D;
						}
					}
				}
			}
		}

		.pophaoyuan {
			overflow: hidden;
			width: 95%;
			margin: 0 auto;
			margin-top: 20rpx;
			padding-bottom: 200rpx;
			position: relative;

			.haoinfo {
				margin-top: 20rpx;

				.haotit {
					font-size: 28rpx;
					line-height: 35rpx;

					span {
						color: orange;
						margin-left: 10rpx;
					}
				}

				.haoi {
					font-size: 24rpx;
					line-height: 35rpx;
				}
			}

			.confirm {
				position: fixed;
				width: 90%;
				left: 5%;
				height: 80rpx;
				line-height: 80rpx;
				border-radius: 50rpx;
				font-size: 32rpx;
				bottom: 150rpx;
				color: #fff;
				background-color: #417ef7;
				text-align: center;
			}

			.haolist {
				display: flex;
				flex-wrap: wrap;
				margin-top: 20rpx;

				.haoitemm {
					width: 216rpx;
					height: 90rpx;
					line-height: 45rpx;
					font-size: 24rpx;
					text-align: center;
					margin: 8rpx;
					border-radius: 10rpx;
					border: 2rpx solid #ccc;
					margin-top: 15rpx;

					span {
						color: #417ef7;
					}
				}

				.active {
					border: 1rpx solid #417ef7;
					background-color: #f5f8ff;
				}
			}
		}

		.popgood {
			overflow: hidden;
			width: 95%;
			margin: 0 auto;
			margin-top: 20rpx;
			padding-bottom: 100rpx;

			.pptit {
				font-size: 35rpx;
				line-height: 50rpx;
				font-weight: bold;
				margin-top: 20rpx;
			}

			.popgtit {
				font-size: 30rpx;
				line-height: 50rpx;
				font-weight: bold;
				margin-top: 20rpx;

			}

			.popinfo {
				margin-top: 20rpx;
				font-size: 28rpx;
				line-height: 35rpx;
			}
		}

		.hoslist {
			width: 93%;
			margin: 0 auto;
			margin-top: 20rpx;
			border-radius: 15rpx;
			background-color: #fff;
			padding-top: 20rpx;
			padding-bottom: 20rpx;

			.hosmain {
				width: 95%;
				margin: 0 auto;

				.haoshuo {
					display: flex;
					justify-content: space-between;
					width: 560rpx;
					margin-left: 100rpx;
					margin-top: 15rpx;
					color: #3D3D3D;

					.haoshuol {
						display: flex;

						.haoloitem {
							display: flex;
							margin-right: 20rpx;

							.haologo {
								width: 30rpx;
								height: 22rpx;
								background-color: #417ef7;
								border-radius: 5rpx;
							}

							.haologoinfo {
								font-size: 22rpx;
								margin-left: 10rpx;
							}
						}

					}

					.haoshuor {
						font-size: 22rpx;
					}
				}

				.zhu {
					width: 560rpx;
					margin-left: 100rpx;
					font-size: 22rpx;
					line-height: 30rpx;
					margin-top: 10rpx;
				}

				.haoyuan {
					display: flex;
					padding-top: 10rpx;
					overflow: hidden;

					.haoyuanl {
						font-size: 28rpx;
						line-height: 100rpx;
						color: #888;
						width: 100rpx;
						margin-top: 70rpx;
					}

					.haoyuanr {
						display: flex;
						overflow: auto;
						width: 95%;
						margin: 0 auto;

						ul {
							overflow: auto;
							display: flex;
							overflow-x: auto;

							li {

								// background: #f5f5f7;
								border-radius: 10rpx;
								text-align: center;

								// margin-right: 12rpx;
								.datetop {
									width: 100rpx;
									text-align: center;
									font-size: 24rpx;
									line-height: 40rpx;

								}

								.haoitem {
									width: 95rpx;
									height: 75rpx;
									border-radius: 10rpx;
									background-color: #F5F6F8;
									margin: 5rpx;
									margin-top: 10rpx;
									line-height: 75rpx;
									color: #fff;
									font-size: 26rpx;
								}


							}
						}
					}
				}

				.suoyou {
					display: flex;
					justify-content: space-between;
					margin-top: 20rpx;

					.allhao {
						display: flex;

						.suoi {
							width: 30rpx;
							height: 30rpx;
							border-radius: 50%;
							border: 1rpx solid #ccc;
							text-align: center;
							line-height: 30rpx;
							font-size: 20rpx;
							color: #fff;
						}

						.suotit {
							font-size: 28rpx;
							line-height: 30rpx;
							margin-left: 10rpx;
						}

						.activeall {
							background-color: #417ef7;

						}
					}

					.shuaxin {
						width: 80rpx;
						height: 40rpx;
						border-radius: 20rpx;
						border: 1.5rpx solid #888;
						color: #888;
						line-height: 40rpx;
						text-align: center;
						overflow: hidden;
						font-size: 22rpx;

						image {
							width: 15rpx;
							height: 15rpx;
							margin-right: 5rpx;
						}
					}
				}

				.hosdep {
					width: 100%;
					display: flex;
					flex-wrap: wrap;
					margin-top: 20rpx;

					.depitem {
						font-size: 24rpx;
						line-height: 50rpx;
						margin-top: 20rpx;
						height: 50rpx;
						border: 1rpx solid #a2a2a2;
						color: #a2a2a2;
						padding-left: 20rpx;
						padding-right: 20rpx;
						// background-color: #f4f7ff;
						margin: 15rpx;
						border-radius: 25rpx;
						position: relative;

						.dian {
							font-size: 80rpx;
							position: absolute;
							top: -47rpx;
							right: -15rpx;
							color: #4581F6;
						}
					}

					.activedep {
						border: 1rpx solid #4581F6;
						color: #4581F6;
						background-color: #f4f7ff;
					}
				}

				.hositem {
					.hostop {
						width: 100%;
						display: flex;
						justify-content: space-between;

						.hostopl {
							display: flex;

							.hosnum {
								width: 40rpx;
								height: 40rpx;
								background-color: #F3B242;
								border-radius: 10rpx;
								text-align: center;
								line-height: 40rpx;
								font-size: 20rpx;
								color: #fff;
							}

							.hositenname {
								font-size: 24rpx;
								line-height: 40rpx;
								margin-left: 10rpx;

								span {
									margin-left: 10rpx;
									color: #999;
								}
							}
						}

						.hostopr {
							display: flex;

							.you {
								width: 50rpx;
								font-size: 20rpx;
								height: 35rpx;
								line-height: 35rpx;
								text-align: center;
								border-radius: 5rpx;
								color: #fff;
								background-color: #57B663;
								margin-right: 5rpx;
							}
						}
					}
				}
			}
		}

		.docinfo {
			width: 93%;
			margin: 0 auto;
			margin-top: 30rpx;
			border-radius: 15rpx;
			background-color: #fff;
			padding-bottom: 15rpx;
			padding-top: 30rpx;
			position: relative;

			.pingfen {
				position: absolute;
				bottom: 60rpx;
				left: 35rpx;
				width: 100rpx;
				text-align: center;
				font-size: 24rpx;
				line-height: 30rpx;

			}

			.goodat {
				width: 92%;
				margin: 0 auto;
				display: flex;
				justify-content: space-between;
				padding-bottom: 10rpx;
				margin-top: 40rpx;

				.ginfo {
					width: 80%;
					font-size: 26rpx;
					height: 30rpx;
					overflow: hidden;
					color: #999;
					line-height: 30rpx;
					letter-spacing: 1rpx;
					display: -webkit-box;
					overflow: hidden;
					text-overflow: ellipsis;
					word-wrap: break-word;
					white-space: normal !important;
					-webkit-line-clamp: 1;
					-webkit-box-orient: vertical;
				}

				.lijie {

					font-size: 26rpx;
					color: #333;
					height: 30rpx;
					line-height: 30rpx;
				}
			}

			.docnum {
				width: 92%;
				margin: 0 auto;
				display: flex;
				justify-content: space-between;
				margin-bottom: 20rpx;
				margin-top: 30rpx;

				.docnumitem {
					width: 33.33%;
					font-size: 26rpx;
					// font-weight: bold;
					// line-height: 50rpx;

					span {
						color: orange;
						margin-left: 10rpx;
					}
				}
			}

			.dochos {
				font-size: 25rpx;
				line-height: 40rpx;
				display: flex;
				flex-wrap: wrap;
				margin-left: 125rpx;
				margin-top: -30rpx;

				.hosnamea {
					width: 400rpx;
					display: flex;
					flex-wrap: wrap;
				}

				.zhilogo {
					width: 80rpx;
					height: 30rpx;
					margin-top: 5rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.hostype {
					font-size: 15rpx;
					padding-left: 6rpx;
					padding-right: 6rpx;
					line-height: 24rpx;
					margin-left: 10rpx;
					margin-top: 5rpx;
					height: 24rpx;
					color: #FF9A00;
					border: 1.5rpx solid #FF9A00;
					border-radius: 5rpx;
				}
			}

			.doctaglist {
				margin-left: 135rpx;
				display: flex;
				flex-wrap: wrap;

				.doctag {
					font-size: 20rpx;
					color: #91562E;
					background-color: #FAD9A7;
					padding-left: 10rpx;
					padding-right: 10rpx;
					line-height: 35rpx;
					height: 35rpx;
					border-radius: 5rpx;
					margin-top: 10rpx;
					margin-right: 10rpx;
				}

				.doctag1 {
					font-size: 20rpx;
					color: #D06B00;
					background-color: #FFCFB5;
					padding-left: 10rpx;
					padding-right: 10rpx;
					line-height: 35rpx;
					border-radius: 5rpx;
					margin-top: 10rpx;
					margin-right: 10rpx;
				}
			}

			.info {
				width: 92%;
				margin: 0 auto;
				display: flex;
				// padding-bottom: 20rpx;

				.infor {
					// width: 90rpx;
					// height: 45rpx;
					// font-size: 20rpx;
					// line-height: 45rpx;
					// color: blue;
					// text-align: center;
					// // background-color: #f4f7ff;
					// border-radius: 22.5rpx;
					display: flex;

					.inforitemr {
						width: 80rpx;
						height: 40rpx;
						font-size: 20rpx;
						line-height: 40rpx;
						// color: blue;
						text-align: center;
						// background-color: #f4f7ff;
						border: 1.5rpx solid #4581F6;
						color: #4581F6;
						border-radius: 25rpx;
					}

					.inforiteml {
						width: 40rpx;
						height: 40rpx;
						border: 1.5rpx solid #4581F6;
						// background-color: #78cf88;
						text-align: center;
						line-height: 50rpx;
						margin-left: 10rpx;
						border-radius: 25rpx;
						overflow: hidden;

						.inforitemll {
							margin-left: 3rpx;
							margin-top: 3rpx;
						}

					}
				}

				.infol {
					display: flex;
					width: 550rpx;

					.docimg {
						width: 90rpx;
						height: 90rpx;
						border-radius: 50%;

						image {
							width: 100%;
							height: 100%;
							border-radius: 50%;
						}
					}

					.doctit {
						margin-left: 15rpx;
						margin-top: 5rpx;

						.docname {
							font-size: 36rpx;
							line-height: 50rpx;
							font-weight: bold;

							span {
								font-weight: normal;
								font-size: 26rpx;
								line-height: 40rpx;
								margin-left: 10rpx;
							}
						}
					}
				}
			}
		}

	}
</style>
